import csv
with open('eggs.csv','w',newline='') as csvfile:
    spamwriter=csv.writer(csvfile,delimiter=' ',quotechar='|')
    spamwriter.writerow(['www.biancheng.net']*5+['how are you'])
    spamwriter.writerow(['hello world','web site','www.biancheng.net'])

with open('aggs.csv','w',newline='') as f:
    writer=csv.writer(f)
    writer.writerows([('hello','world'),('I','love','you')])

with open('names.csv','w',newline='') as csvfile:
    fieldnames=['first_name','last_name']
    writer=csv.DictWriter(csvfile,fieldnames=fieldnames)
    writer.writeheader()
    writer.writerows([{'first_name': 'Baked', 'last_name': 'Beans'},{'first_name': 'Lovely', 'last_name': 'Spam'}])
    writer.writerow({'first_name': 'Wonderful', 'last_name': 'Spam'})
